package com.servlet;

import com.tomcat.HttpRequest;
import com.tomcat.HttpResponse;

public class HttpServlet implements Servlet{
    @Override
    public void service(HttpRequest httpRequest, HttpResponse httpResponse) {
        if ("GET".equalsIgnoreCase(httpRequest.getMethod())) {
            doGet(httpRequest, httpResponse);
        } else if ("POST".equalsIgnoreCase(httpRequest.getMethod())) {
            doPost(httpRequest, httpResponse);
        }
    }

    @Override
    public void doGet(HttpRequest httpRequest, HttpResponse httpResponse) {
        System.out.println("执行doGet方法!");
    }

    @Override
    public void doPost(HttpRequest httpRequest, HttpResponse httpResponse) {
        System.out.println("执行doPost方法!");
    }
}
